package org.karelun.whiteboard.edit.factory;

import org.karelun.whiteboard.Sheet;
import org.karelun.whiteboard.Triangle;
import org.karelun.whiteboard.editparts.SheetEditPart;
import org.karelun.whiteboard.editparts.TriangleEditPart;
import org.karelun.whiteboard.gef.EditPart;
import org.karelun.whiteboard.gef.EditPartFactory;

/**
 * @Author: KarelunHuang
 * @Date: Jan 23, 2013
 **/
public class PartFactory implements EditPartFactory{

	@Override
	public EditPart createEditPart(EditPart context, Object model) {
		EditPart editpart=null;
		if(model instanceof Sheet){
			editpart=new SheetEditPart();
		}else if(model instanceof Triangle){
			editpart=new TriangleEditPart();
		}
		editpart.setModel(model);
		return editpart;
	}

}
